﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace TestPlanWordWriter.Common
{
    public class StreamUtil
    {
        private const int BUFFER_LENGTH = 65536;

        public static void CopyStream(Stream sourceStream, Stream targetStream)
        {
            byte[] buffer = new byte[BUFFER_LENGTH];

            int readBytes = sourceStream.Read(buffer, 0, buffer.Length);
            while (readBytes > 0)
            {
                targetStream.Write(buffer, 0, readBytes);
                readBytes = sourceStream.Read(buffer, 0, buffer.Length);
            }
        }
    }
}
